//
//  Person.m
//  构架模式MVC
//
//  Created by XHJ on 2020/8/27.
//  Copyright © 2020 L. All rights reserved.
//

#import "Person.h"
#import "DataModel.h"

@implementation Person

- (instancetype)init {
    self = [super init];
    if (self) {
        _dataArray = [NSArray array];
        [self loadData];
    }
    return self;
}
- (void)loadData {
    NSArray *dataArray = @[@{@"name":@"小红", @"subName":@"狗蛋"},
                           @{@"name":@"小王", @"subName":@"石头"},
                           @{@"name":@"小张", @"subName":@"土豆"},
                           @{@"name":@"小李", @"subName":@"狗蛋1"},
                           @{@"name":@"小海", @"subName":@"石头2"},
                           @{@"name":@"小明", @"subName":@"土豆3"}];
    NSMutableArray *tempArr = [NSMutableArray array];
    for (NSDictionary *dic in dataArray) {
        DataModel *model = [DataModel modelWithDictionary:dic];
        NSLog(@" model : %@", model.name);
        [tempArr addObject:model];
    }
    _dataArray = tempArr;
}

@end
